Fault injection selection

ABSTRACT

A system and method for injecting faults are described. Faults may be injected into a process to determine if a given module handles the fault properly.

BACKGROUND OF THE INVENTION

1. Field of the Invention

Aspects of the present invention relate to computer systems. Moreparticularly, aspects of the present invention relate to testing ofcomputer systems.

2. Description of Related Art

Computer system developers desire to release bug-free systems and/orapplications. Be it hardware, software, or firmware, all computerproducts undergo some level of testing. Conventional testing systemsallow test operators to specify a fault to occur and allow a system toencounter a fault. Often, identical processes may slightly differ intheir execution based on environmental conditions. These alterations ofthe processes complicate testing procedures in that testing systems lackrepeatability once a system error caused by the fault has beenencountered.

FIG. 2 shows an example of a conventional testing process. In step 201,a user sets high-level testing conditions for a test to be run includinga selection of a fault to occur. In step 202, a test is run. In step203, the system reports a fault if, for example, a process attempted toaccess X, where X is a memory or an attempt to write or read from adrive, and the like. In step 204, the system monitors the results andreports and error if the system did not handle the fault properly. Ingeneral, conventional testing systems monitor application programminginterface interactions and change return values according to a faultbeing created. Here, these systems allow a user to specify a percentagechance that a fault may occur (e.g., 90% of a memory fault to occur).The purpose of specifying the percentage fault is to allow some faultsto occur later, thereby identifying processes that cannot handle thefault that would normally be shielded from receiving the fault becauseof the fault being handled previously. A difficulty with the systemaccording to FIG. 2 is that the testing process does not consistentlyuncover fault handling problems that are buried deep in a call stackbecause the percentage fault specification may mean that a given processis repeatedly skipped. Similarly, one module may appropriately handle afault, while masking another module's failure to handle the fault.

FIG. 3 shows an example of how a call stack may implement specifiedmodules processes. Call stack 1 301 contain calls to various modules.Call stack 1 301 includes calls 304-310 that call modules 1 through 5311-315 in the following order: 1, 3, 2, 1, 4, 1, and 5. A fault may behandled at call 304 while testing needed at calls 307 and 309 neveroccurs or occurs in an unpredictable pattern (because of the percentagefault chance described above).

A process for selectively initiating faults and for testing operatingsystem functions is needed.

BRIEF SUMMARY OF THE INVENTION

Aspects of the present invention addressed one or more of the issuesdescribed above, thereby providing an improved testing method and systemfor developers.

BRIEF DESCRIPTION OF THE DRAWINGS

Aspects of the present invention are illustrated by way of example andnot limited in the accompanying figures in which like reference numeralsindicate similar elements.

FIG. 1 shows a general-purpose computing environment in accordance withaspects of the present invention.

FIGS. 2-3 show conventional testing processes.

FIG. 4 shows a system in accordance with aspects of the presentinvention.

FIG. 5 shows various levels where functions may be addressed inaccordance with aspects of the present invention.

FIG. 6 shows alternative approaches to controlling fault injection inaccordance with aspects of the present invention.

FIGS. 7 and 8 show multiple call stacks with different execution ordersin accordance with aspects of the present invention.

FIG. 9 shows fault injection at specific modules in accordance withaspects of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Aspects of the present invention relate to injecting faults duringtesting phases.

The following description is separated into the following sections:general purpose computing environment; and fault injection.

General Purpose Computing Environment

With reference to FIG. 1, an exemplary system for implementing theinvention includes a computing device, such as computing device 100. Inits most basic configuration, computing device 100 typically includes atleast one processing unit 102 and memory 104. Depending on the exactconfiguration and type of computing device, memory 104 may be volatile(such as RAM), non-volatile (such as ROM, flash memory, etc.) or somecombination of the two. This most basic configuration is illustrated inFIG. 1 by dashed line 106. Additionally, device 100 may also haveadditional features/functionality. For example, device 100 may alsoinclude additional storage (removable and/or non-removable) including,but not limited to, magnetic or optical disks or tape. Such additionalstorage is illustrated in FIG. 1 by removable storage 108 andnon-removable storage 110. Computer storage media includes volatile andnonvolatile, removable and non-removable media implemented in any methodor technology for storage of information such as computer readableinstructions, data structures, program modules or other data. Memory104, removable storage 108 and non-removable storage 110 are allexamples of computer storage media. Computer storage media includes, butis not limited to, RAM, ROM, EEPROM, flash memory or other memorytechnology, CD-ROM, digital versatile disks (DVD) or other opticalstorage, magnetic cassettes, magnetic tape, magnetic disk storage orother magnetic storage devices, or any other medium which can be used tostore the desired information and which can accessed by device 100. Anysuch computer storage media may be part of device 100.

Device 100 may also contain communications connection(s) 112 that allowthe device to communicate with other devices. Communicationsconnection(s) 112 is an example of communication media. Communicationmedia typically embodies computer readable instructions, datastructures, program modules or other data in a modulated data signalsuch as a carrier wave or other transport mechanism and includes anyinformation delivery media. The term “modulated data signal” means asignal that has one or more of its characteristics set or changed insuch a manner as to encode information in the signal. By way of example,and not limitation, communication media includes wired media such as awired network or direct-wired connection, and wireless media such asacoustic, RF, infrared and other wireless media. The term computerreadable media as used herein includes both storage media andcommunication media.

Device 100 may also have input device(s) 114 such as keyboard, mouse,pen, voice input device, touch input device, etc. Output device(s) 116such as a display, speakers, printer, etc. may also be included. Allthese devices are well know in the art and need not be discussed atlength here.

Automated and Manual Testing

Testing of computer systems can be a time-consuming and tedious process.Two types of testing exist: automated testing and manual testing.Automated testing requires the running of an application on a testmachine. The test application and any dependencies have to bepreconfigured on a test machine before the test is executed. Thesedependencies include files, environment variable settings, registrysettings, and commands. There can be a significant number ofdependencies, of which failing to enable one will jeopardize thevalidity of a test run.

Manual testing is another commonly used testing system. Manual testingincludes having a user physically control a system to approach a desiredcondition and then monitoring the condition. For instance, this mayinclude a game developer controlling a game to reach a desired pointthen evaluate performance or rendering of the game. Consistently beingable to reach the same predefined location may be jeopardized bymodifications to the environment, thereby making consistent testingdifficult.

A modified version of automated and manual testing may also be used.Here, “semi-automated testing” may be used to automate some portion ofthe testing process (e.g. system configuration) that requires manualinteraction.

In an additional aspect of the invention, the approach described hereinmay be used for more than fault injection alone. In particular,application compatibility or emulation modification may be tested. Forexample, aspects of the present invention allow a testing system tomodify how responses are handled. These aspects allow a developer tochange program interfaces (or behavior responses) without having torewrite the actual code for a program. Here, for instance, one mayautomate gameplay to perform an action (for instance, walk forward, turnand look at a wall). Also, one may receive an instruction, partiallycomplete the instruction, but return that the instruction was completed.

Fault Injection

Prior to public release of software, the software undergoes extensivetesting. Because of the complexities of code, automated testing systemsare used to accurately perform tests. These automated tests providerepeatability to provide testers the ability to determine if softwaremodifications actually work.

Automated tests and good code coverage results require that conditionsbe repeatable and that error handling code be exercised. Aspects of thepresent invention provide a process for injecting a fault at a specificmodule or process to determine how the module or process responds to thefault injection.

Aspects of the present invention may include the use of COM objects tocreate relationships between elements. Objects may be implanted usingother approaches as well.

Aspects of the present invention permit a user to identify a module orprocess and instruct a testing system to inject a fault for that moduleor process. For instance, one may use Detours by the MicrosoftCorporation of Redmond, Wash., to intercept the execution of functions.Detours is a library for instrumenting arbitrary Win32 functions on x86machines. Detours intercepts Win32 functions by re-writing targetfunction images. Detours copy out first few bytes of a process and pushthe process to execute different code.

The system may also use files that relate source code with binaryrepresentations. For instance, Pilot Database (PDB) files created duringcompiling may be used to set up faults that may be used at any time andto trigger faults to occur in specific processing units, processes, orthreads when desired. Aspects of the present invention allows thedeveloper to specify the type of fault. For the specified fault, aspectsof the present invention begin and end with a given function call withinthe binary being tested. In one embodiment, a COM object is created toachieve these and other advantages.

Adequate testing is important. Stress failures and system lockups cancome from untested error handling routines. Rather than existing toolswhich let one set a random chance of a failure happening or for afailure to happen throughout a test, aspects of the present inventionallow developers to target faults (or failures) to specific known timesto more easily reproduce a problem and consistently verify the errorhandling code for increased reliability.

A second benefit of aspects of the invention is the ability to parse thefiles that relate source and binary code (e.g., PDB files) for binary,randomly read functions and be able to record what fault is injected inwhat function. For long-haul testing, this may allow developers to findfunctions that are missing required error handling code. Since the faultis known and the running of what function was in place at the time thefault was injected, one may address the problem and fix it.

Function hooks may be used that bracket functions with identifiablecode. These function hooks allow a system to be cognizant when thespecific code is executed. With the combined capabilities to compare thePDB files to function hooks, there is also the ability to injectexceptions at given points in time or to even make an internal call withthe binary fail, rather than having to rely on only hooking externalAPIs as current fault injection packages do.

Since aspects of the present invention relate to hooking specificfunctions within binaries rather than APIs between binary dependencies,hooking at the lowest level functions in a dependency tree for creatingthe fault.

Most fault injection packages rest on top of the operating system'sapplication programming interface calls making them more difficult forthe operating system to use in testing itself.

FIG. 4 shows an illustrative example of a system in accordance withaspects of the present invention. Test cycle 401 allows a developer toset up the testing process. For instance, the testing process may bemanual or automatic. Test cycle 401 may also be referred to as anexecution cycle when performing execution modifications but not testing(for instance, when emulating another system).

Test cycle 401 includes a test initialization process 402 and a testexecution process 403. In the test initialization process, the system isconfigured to inject faults into a running process or processes. Thetest initialization process 402 uses a surgical fault injection object404 to perform a number of items.

First, surgical fault injection object 404 initializes surgical faultinjection in step 405. This initialization step defines what faultsexist. For instance, running out of memory faults, insufficientwriting/reading/erasing privileges, and the like are examples of typesof faults that may be injected to one or more running processes. It isappreciated that any fault that is run in a testing procedure may beused.

In step 406, the system loads or creates fault interfaces. The faultinterfaces are the relationships by which the faults are addressed.

For each function and for each fault, a fault creator object 407 exists.The fault creator object 407 includes the following: it determines if afault has been turned off or turned on in step 408, it includes theoriginal routine 409, replaces a normal return value with a desiredfault 410, and/or calls something completely different 420. As shown inbroken lines, the various responses are optional; other responses may beperformed in place of or in addition to these responses as well. Inshort, the fault creator knows how it wraps an original routine toproduce a fault.

Surgical fault injection object 404 includes a set fault condition step411 that indicates the type fault condition to occur. In the setinterception function step 412, the specific indication where the faultis to occur is provided.

Step 412 indicates which process or sub process is to be provided with afault. The fault may trigger at the beginning of the process, the end ofthe process, randomly in the middle of the process or at the Nthexecution of a function call. The fault may be triggered when a specificroutine identifier is handled by a processor. Alternatively, a functioncall may be wrapped with a wrapper that redirects the execution of thefunction call to an alternate location. In short, step 412 specifieswhere a fault is to occur.

Test cycle 401 also includes test execution 403 process. Test executionprocess 403 includes step 413 that determines if a function to beintercepted has been called. If a selected function has been called,then a function interceptor 414 that has been instantiated by the setinterception function step 412 is executed. In step 415, the processdetermines whether a fault for the intercepted function has beenenabled. If no, from step 415, the system executes the binary functionas originally provided in step 417 then returns to step 413 to wait forthe next intercepted function. If yes from step 415, the fault isenabled in step 416, the binary function is performed with the faultenabled in step 418, and the fault is turned off in step 419. By thispoint, the execution of the binary function in step 418 may or may nothave caused an error condition by the state of the fault. The occurrenceand/or non-occurrence of the error condition may be logged for review.

FIG. 5 shows an illustrative example of how one may specify a specificfunction. An operating system 501 may call a shell 502, which then maycall a graphical device interface 503, which may then call kernel 504.Here, kernel 504 has been wrapped with wrapper 505 to allow a system todetermine when kernel 504 has been called. Further, in addition towrapping a single procedure, one may wrap multiple procedures or layers.Additionally, one may specify specific branches in functions within alayer or the combination. For instance, one may wrap (507) GDI kernel506. Also, one may wrap (511) kernel B 509 between kernels A 508 and C510.

FIG. 6 shows an alternative approach to controlling processes whenfaults are injected. First, the system may specifically control thetiming of processes and when they execute. For instance, one may specifythat a process is to occur at a specific time in step 601. At thebeginning of the process, during or at the end of the process, the faultmay be injected in step 603. Finally, the result is monitored in step604. The process of FIG. 5 relates to singular threads as well asmulti-process hyperthreading and any method of executing more than onesection of executable code at the same time.

Alternatively, in step 602, the system may lock other processes fromoccurring. In step 605, the system may lock other threads fromexecuting. These locks provide the benefit of ensuring that no otherprocesses or threads occur while the selected process is running.

FIG. 7 shows multiple stacks associated with common modules. Here, callstack 1 701 includes calls 704-710 (referencing modules 1-5 711-715) thecall modules 1 through 5 in the following order: 1, 3, 2, 1, 4, 1 and 5.Call stack 2 702 includes calls 716-722 that call modules 1 through 5 inthe following order: 1, 2, 3, 1, 5, 1, and 4. Here, in call stack 1 701,module 3 713 is called before module 2 712. Yet, in call stack 2 702,module 2 712 is called before module 3 718. Aspects of the presentinvention allow a call to a specific module to be wrapped and faultinjected/alternative process performed. By handling specific calls, onemay identify exactly where incorrect fault handling has occurred. Also,one may specifically alter an application's performance by handlingspecific calls as desired.

For example, FIG. 8 shows a process where the order of calls in a callstack modifies the results of a test. Prior systems would not haveidentified that module 2 does not properly deal with a fault X 401, forexample, because this fault X 401 is eliminated by module 3. Priorsystem's execution of call stack 1 701 would not uncover this problemwith module 2 because module 3 would have been called by call 705 aheadof call 706. In contrast, aspects of the present invention are able tooperate on specific calls, thereby removing ambiguity whether a call isto be tested based on where it is in a call stack. In call stack 2 702,module 2 is called before module 3 by calls 717 and 718, respectively.The slight modification of the order of the execution of modules invarious call stacks may have detrimental effects on previous testingsystems but is handled properly by at least some aspects of the presentinvention.

FIG. 9 shows a fault being injected into multiple executions of amodule. Here, call stack 1 901 includes calls 902-908 to modules 1-3 inthe following order: 1, 2, 3, 1, 2, 3, and 1. Here, model 2 (at calllocations 903 and 906) calls each of modules 4-6 909-911. The faultinjection is occurring at module 5. In particular, fault X 912 isstarting with the begging of the execution of module 5 910 and endingwith the end of the execution of module 5. This example is testing onlymodule 5 as called from module 2.

Alternative ways of detecting when faults are to be injected includespecifying and monitoring interrupts and setting flags.

A pluggable interface may be provided so that a developer may add hisown faults that may be feature specific or reside at a higher level thanthe low level kernel functions. Further, a given fault can be set totrigger during any random function call from a given PDB set with thefault, function, and runtime kicked out to a debugger log. A givenexception can be thrown at any of the previous three conditions as well.

Aspects of the present invention may use exception handling techniquesin additional to other techniques including processor interrupts.

Aspects of the present invention may be applied in various ways. Usingthe lower level hooks (wrappers for executing kernels), aspects of thepresent invention permit testing of higher level functions that accessthe wrapped kernels. Also, one may perform fault checks to ensure thatall code in an application or operating system is being used. Finally,one may create function interceptors to wrap individual or groupfunctions to better test applications and operating systems. In additionto wrapping a single kernel, one may wrap multiple kernels or layers.Additionally, one may specify specific branches in functions within alayer or the combination.

Aspects of the present invention have been described in terms ofpreferred and illustrative embodiments thereof. Numerous otherembodiments, modifications and variations within the scope and spirit ofthe appended claims will occur to persons of ordinary skill in the artfrom a review of this disclosure.

1. A process for establishing when faults are to be injected into arunning function comprising the steps of: specifying a fault to occur;determining a function to fault; assigning a start location in saidfunction where said fault is to start; assigning a stop location in saidfunction where said fault is to stop; and designating said function tohave operating priority over other functions during operation of saidfunction.
 2. The process according to claim 1, further comprising thestep of: designating said function to lock other functions fromoccurring during said function.
 3. The process according to claim 1,further comprising the step of: defining said fault to occur on anexecutable module.
 4. A system for establishing when faults are to beinjected into a running function comprising: means for specifying afault to occur; means for determining a function to fault; means forassigning a start location in said function where said fault is tostart; means for assigning a stop location in said function where saidfault is to stop; and means for designating said function to ha eoperating priority over other functions during operation of saidfunction.
 5. The system according to claim 4, further comprising: meansfor designating said function to lock other functions from occurringduring said function.
 6. The system according to claim 4, furthercomprising: means for defining said fault to occur on an executablemodule.
 7. A computer-readable storage medium having a program storedthereon, said program for establishing when faults are to be injectedinto a running function, said program comprising the steps of:specifying a fault to occur; determining a function to fault; assigninga start location in said function where said fault is to start;assigning a stop location in said function where said fault is to stop;and designating said function to have operating priority over otherfunctions during operation of said function.
 8. The computer-readablestorage medium according to claim 7, said program further comprising thesteps of: designating said function to lock other functions fromoccurring during said function.
 9. The computer-readable storage mediumaccording to claim 7, further comprising the step of: defining saidfault to occur on an executable module.
 10. A process for establishingwhen faults are to be injected into a running function comprising thesteps of: initializing surgical fault injection; loading faultinterfaces; setting one or more fault conditions; setting one or morefunctions to be intercepted; and designating said one or more functionsto lock other functions from occurring during said one or morefunctions.
 11. The process according to claim 10, further comprising thestep of: specifying a monitoring of a reaction of said function to saidfault injection.
 12. A system for establishing when faults are to beinjected into a running function comprising: means for initializingsurgical fault injection; means for loading fault interfaces; means forsetting one or more fault conditions; means for setting one or morefunctions to be intercepted; and means for designating said one or morefunctions to lock other functions from occurring during said or morefunctions.
 13. The system according to claim 12, further comprising:means for specifying a monitoring of a reaction of said function to saidfault injection.
 14. A computer-readable storage medium having a programstored thereon for establishing when faults are to be injected into arunning function, said program comprising the steps of: initializingsurgical fault injection; loading fault interfaces; setting one or morefault conditions; setting one or more functions to be intercepted; anddesignating said one or more functions to lock other functions fromoccurring during said one or more functions.
 15. The computer-readablestorage medium according to claim 14, said program further comprisingthe step of: specifying a monitoring of a reaction of said function tosaid fault injection.